<?php
require_once('config.inc.php');
require_once('DatabaseManager.php');

session_start();

$db = new DatabaseManager;
$db -> createDB();

$dbname = DB_NAME;

/* make connection to database */
MYSQL_CONNECT(DB_SERVER,DB_USER_NAME,DB_USER_PASSWORD) OR DIE("Datenbankverbindung konnte nicht hergestellt werden!");
@mysql_select_db("$dbname") or die("Datenbank nicht gefunden!"); 

PRINT "<html>";
PRINT "<head><title>Mail senden</title></head>";
PRINT "<body>";

if(!@$mail_to = $_POST["mail_to"])
		$mail_to = 'blA';
if(!@$mail_subject = $_POST["mail_subject"])
		$mail_subject = 'NULL';
if(!@$mail_content = $_POST["mail_content"])
		$mail_content = 'NULL';

		include ("mailto.php");
		$mail = new Mail();
						
		$tmp_usr_id = intval($_SESSION['user_id']);
						
		$sql = "SELECT mail FROM userdata WHERE user_id='".$tmp_usr_id."'";
		$result = mysql_query($sql);

		$data_from = mysql_result($result, 0, "mail");

		
		//$mail->send($data_from, $mail_to, $mail_subject, $mail_content, NULL); //->doto NULL = file

PRINT "Folgende Daten wurden eingegeben:<br>";
PRINT "<ul>";
PRINT "<li>An: <em>$mail_to</em>";
PRINT "<li>Betreff: <em>$mail_subject</em>";
PRINT "<li>Text: <em>$mail_content</em>";
PRINT "</ul>";
PRINT "<hr>";
PRINT "<br>";
PRINT "<a href=\"index.php\">OK-Start</a>";
PRINT "</body>";
PRINT "</html>";
		
/* Close the database connection */
MYSQL_CLOSE();
?>